package SSF.OS.UDP;

import SSF.OS.*;

/** Simplified UDP Header. */
public class UDP_Header extends ProtocolMessage {

  /********************* Standard UDP Header Variables *********************/

  /** destination port number */
  public int DEST_port;

  /** source port number */
  public int SOURCE_port;

  /** UDP payload length */
  public int length;

  /************************* Constructors ************************/

  public UDP_Header(int src_port, int dest_port, int data_length) {
    SOURCE_port = src_port;
    DEST_port = dest_port;
    length = data_length;
  }
  
  /************************ Class Methods ***********************/

  /** print out the UDP message*/
  public String toString() {
    return "[UDP hdr: sPort " + SOURCE_port
             + " dPort " + DEST_port
             + " size " + length + "]";
  }

  /** number of bytes in the header of this UDP message */
  public int header_bytecount(){
    return 8;
  }

  /** total number of bytes in this UDP message */
  public int bytecount(){
    return (8 + length);
  }
}
